package metrics_sql

const (
	SumApplicationKubernetes = `
object = "%v"
platform = "%v"
metric = "%v"
guid = "%v"

childs = /^(%v)$/

start = %v
end = %v

from(bucket: "data")
  |> range(start: start, stop: end)
  |> filter(fn: (r) => r["_measurement"] == "prometheus_remote_write")
  |> filter(fn: (r) => r["_field"] == "metrics")
  |> filter(fn: (r) => r["label"] == metric)
  |> filter(fn: (r) => r["platform"] == platform)
  |> filter(fn: (r) => r["object"] == object)
  |> filter(fn: (r) => r["application_guid"] == guid)
  |> filter(fn: (r) => r["container"] =~ childs)
  |> group(columns: ["platform","application_guid","object","label","_time"])
  |> sum()
`
	SumApplicationGluenets = `
object = "%v"
platform = "%v"
metric = "%v"
guid = "%v"
container = /^(%v)$/

start = %v
end = %v

from(bucket: "data")
  |> range(start: start, stop: end)
  |> filter(fn: (r) => r["_measurement"] == "prometheus_remote_write")
  |> filter(fn: (r) => r["_field"] == "metrics")
  |> filter(fn: (r) => r["label"] == metric)
  |> filter(fn: (r) => r["platform"] == platform)
  |> filter(fn: (r) => r["object"] == object)
  |> filter(fn: (r) => r["application_guid"] == guid)
  |> filter(fn: (r) => r["container"] =~ container)
  |> group(columns: ["platform","application_guid","object","label","_time"])
  |> sum()
`

	SumMachineKubernetes = `
object = "%v"
platform = "%v"
metric = "%v"
guid = "%v"

childs = /^(%v)$/

start = %v
end = %v

from(bucket: "data")
  |> range(start: start, stop: end)
  |> filter(fn: (r) => r["_measurement"] == "prometheus_remote_write")
  |> filter(fn: (r) => r["_field"] == "metrics")
  |> filter(fn: (r) => r["label"] == metric)
  |> filter(fn: (r) => r["platform"] == platform)
  |> filter(fn: (r) => r["object"] == object)
  |> filter(fn: (r) => r["agent_guid"] == guid)
  |> filter(fn: (r) => r["host_name"] =~ childs)
  |> group(columns: ["platform","agent_guid","object","label","_time"])
  |> sum()
`

	SumMachineGluenets = `
object = "%v"
platform = "%v"
metric = "%v"
guid = "%v"

childs = /^(%v)$/

start = %v
end = %v

from(bucket: "data")
  |> range(start: start, stop: end)
  |> filter(fn: (r) => r["_measurement"] == "prometheus_remote_write")
  |> filter(fn: (r) => r["_field"] == "metrics")
  |> filter(fn: (r) => r["label"] == metric)
  |> filter(fn: (r) => r["platform"] == platform)
  |> filter(fn: (r) => r["object"] == object)
  |> filter(fn: (r) => r["agent_guid"] == guid)
  |> filter(fn: (r) => r["host_name"] =~ childs)
  |> group(columns: ["platform","object","agent_guid","label","_time"])
  |> sum()
`
)
